<%@ page import="java.util.List" %>
<%@ page import="pojo.Bill" %><%--
  Created by IntelliJ IDEA.
  User: konley
  Date: 2020/6/10
  Time: 23:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>消费记录 | 学生饭卡管理系统</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/css.css"/>
    <script src="${pageContext.request.contextPath }/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath }/js/jquery-3.4.1.js" type="text/javascript"
            charset="utf-8"></script>
    <style type="text/css">
        body{
            background-image: url("photo/bg.jpg");
        }
    </style>
</head>
<!--top-->
<div style="background-color:#444;">
    <div class="container">
        <div class="row">
            <h2 style="color: white;font-weight: bold;" >校园一卡通系统 | <span style="color: #FF6666;">账单</span></h2>
        </div>
    </div>
</div>
<div class="container">
    <%
        List<Bill> bills = (List<Bill>) request.getAttribute("bills");
        int cid = bills.get(0).getCid();
    %>
    <br><br>
    <!--卡号-->
    <div class="row">
        <div class="panel panel-info">
            <div class="panel-heading">
                <h2 class="panel-title">账号消费记录</h2>
            </div>
            <div class="panel-body">
                <h4>卡号：<kbd><%=cid%>
                </kbd></h4>
                <br>
                <table class="table table-striped table-bordered table-hover">
                    <thead>
                    <tr>
                        <strong>
                            <td>账单号</td>
                            <td>消费类型</td>
                            <td>金额</td>
                            <td>地点</td>
                            <td>日期</td>
                        </strong>
                    </tr>
                    </thead>
                    <tbody>
                    <% for (Bill bill : bills) { %>
                    <% String color = bill.getType().equals("消费") ? "darkred" : "green";%>
                    <tr>
                        <td><%=bill.getBid()%></td>
                        <td style="color:<%=color%>">
                            <%=bill.getType()%>
                        </td>
                        <td style="color:<%=color%>"><%=bill.getMoney()%>.00元</td>
                        <td><%=bill.getAddress()%>
                        </td>
                        <td><%=bill.getTime()%>
                        </td>
                    </tr>
                    <% } %>
                    </tbody>
                </table>
            </div>
            <div class="panel-footer " style="text-align: right">
                <a href="BillServlet?m=backStu&cid=<%=cid%>">
                    <button type="button" class="btn btn-danger btn-sm">返回我的主页</button>
                </a>
            </div>
        </div>
    </div>
</div>
</body>
</html>
